package com.shhm.admin.controller;

import com.shhm.admin.service.AuthWhiteService;
import com.shhm.common.annotations.OperateLog;
import com.shhm.common.dto.request.RequestList;
import com.shhm.common.dto.response.AjaxResultPlus;
import com.shhm.common.entity.system.SysPassAuth;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.web.bind.annotation.*;

/**
 * @author JackZ
 * @version 1.0
 * @description: TODO
 * @date 2025/9/7 下午8:26
 */
@RestController
@RequestMapping("/admin")
public class AuthWhiteController {
    @Resource
    private AuthWhiteService authWhiteService;

    @GetMapping("/auth")
    public AjaxResultPlus pageList(
            @RequestParam(defaultValue = "1") Integer pageNum,
            @RequestParam(defaultValue = "10") Integer pageSize,
            @RequestParam(defaultValue = "1") Integer isPage,
            HttpServletRequest request
    ){
        return authWhiteService.pageList(pageNum,pageSize,isPage,request);
    }

    @PostMapping("/auth/search")
    public AjaxResultPlus pageSearchList(
            @RequestParam(defaultValue = "1") Integer pageNum,
            @RequestParam(defaultValue = "10") Integer pageSize,
            @RequestBody SysPassAuth entity
    ){
        return authWhiteService.pageSearchList(pageNum,pageSize,entity);
    }

    @PostMapping("/auth")
    @OperateLog(module="菜单管理",type = "POST",desc = "添加系统菜单信息")
    public AjaxResultPlus add(@RequestBody SysPassAuth entity){
        return authWhiteService.add(entity);
    }

    @PutMapping("/auth")
    @OperateLog(module="菜单管理",type = "PUT",desc = "修改系统菜单信息")
    public AjaxResultPlus update(@RequestBody SysPassAuth entity){
        return authWhiteService.update(entity);
    }

    @DeleteMapping("/auth")
    @OperateLog(module="菜单管理",type = "DELETE",desc = "删除系统菜单")
    public AjaxResultPlus delete(@RequestBody RequestList ids){
        return authWhiteService.delete(ids);
    }
}
